{% extends "profilebase.html" %}

{% block sidebar_title %}
{% if profileOwner %}
	<h4>Upload a new photo</h4>
{% else %}
	<h4>About {{ currentUser.abstract_user.user.username }}</h4>
{% endif %}
{% endblock %}

{% block sidebar_content %}
{% if profileOwner %}
	<form action="/myprofile/addPhoto/" method="post" enctype="multipart/form-data">{% csrf_token %}
		{{ form.non_field_errors }}
		{% for field in form %}
			<div class="fieldWrapper">
			{{ field.label_tag }}
			{% if error_message %}
				<br/><br/><label class="text" style="color:#FF0000" >{{ error_message }}</label><br/>
			{% endif %}
			{% if field.errors %}
				<br/><br/><label class="text" style="color:#FF0000;" >Maybe choose a photo before trying to upload...</label><br/>
			{% endif %}
			{{ field }}
			<br/><br/>Caption:<br/><input type="text" name="caption"/><br/><br/>
			<input type="submit" id="search_btn" value="Upload" />
			</div>
		{% endfor %}  	
	</form>
				
{% else %}
	
		{% if logoPath %}<img border="0" src={{ logoPath }} />{% endif %}
		
		{% if my_teachers %}
			<h5>Our Teachers:</h5>
			{% for teacher in my_teachers %}
				<label style="font-size:15px;"><a href="/myprofile/{{ teacher.abstract_user.id }}/">{{ teacher.abstract_user }}</a></label><br/>
				<small>Teaches: {{ teacher.teaches }}</small><br/><br/>
			{% endfor %}
		{% endif %}
	
	
		{% if currentUser.about %}<h5>About: </h5><p>{{ currentUser.about }}</p>{% endif %}
		{% if currentUser.open_on %}<h5>Open On: </h5><p>{{ currentUser.open_on }}</p>{% endif %}
		{% if currentUser.open_from %}<h5>Open From: </h5><p>{{ currentUser.open_from }}</p>{% endif %}
		{% if currentUser.open_to %}<h5>Open To: </h5><p>{{ currentUser.open_to }}</p>{% endif %}
		{% if currentUser.address %}<h5>Address: </h5><p>{{ currentUser.address }}</p>{% endif %}
			
		
{% endif %}
{% endblock %}

{% block main_title %}<h1>Photos</h1>{% endblock %}

{% block main_subtitle %}{% if del_success_message %}{{ del_success_message }}{% endif %}{% endblock %}

{% block main_content %}
{% for photo in photos %}
	{% if photo.caption %}{{ photo.caption }}<br/><br/>{% endif %}
	<img border="0" src={{ photo.path }}></img><br/><br/><br/>
	{% if profileOwner %}
		<small><a href="/myprofile/deletePhoto/{{ photo.id }}/">delete</a></small>
	{% endif %}
	<br/><br/>
{% endfor %}
{% endblock %}
